import time
from timeit import timeit

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome(executable_path='Chromedriver.exe')
driver.get("http://121.43.169.97:8848/pageA.html")


# 1.填写注册信息
driver.find_element_by_css_selector("#userA").send_keys("admin")
# 2.保存截图
# 使用截屏方法
# driver.get_screenshot_as_file("../img/admin.png")


# 动态获取文件名称，使用时间戳
# driver.get_screenshot_as_file("../img/%s.png" %(time.strftime("%Y_%m_%d_%H_%M_%S")))
driver.get_screenshot_as_file("../img/{}.png" .format(time.strftime("%Y_%m_%d_%H_%M_%S")))